import store from "@/store/store";

/**
 * 自定义指令，判断权限
 * @type {{install(*, *): void}}
 */
const hasPerm = {
    install(Vue, options) {
        Vue.directive('hasPerm', {
            inserted(el, binding, vnode) {
                let permissionList = localStorage.getItem("cmsRole");
                if (!permissionList || !permissionList.includes(binding.value)) {
                    if (el.parentNode) {
                        el.parentNode.removeChild(el)
                    }else{
                        console.log("删除失败");
                    }
                }
            }
        })
    }
}


export default hasPerm